package com.woorigil.social.domain.subscribe;

import java.util.Properties;

import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class SendMail {
	public void excute() {
		try {
			Properties prop = new Properties();
			prop.put("mail.smtp.host", "localhost");
			prop.put("mail.smtp.user", "master");
	
			Session session = Session.getDefaultInstance(prop, null);
			
			MimeMessage message = new MimeMessage(session);
			InternetAddress from = new InternetAddress("webmaster@couponplay.kr");
			message.setFrom(from);
	
			InternetAddress to = new InternetAddress("ezblog@naver.com", "ezblog");
			InternetAddress[] toList = {to};
			message.setRecipients(Message.RecipientType.TO, toList);
			message.setSubject("send mail test");
			message.setContent("메일 전송 테스트입니다.", "text/plain;charset=UTF-8");
			Transport.send(message);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
